package org.wlw.web.servlet;

import org.wlw.web.anno.Resource;
import org.wlw.web.models.User;
import org.wlw.web.service.IUserService;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/test/user")
public class TestServlet extends BaseServlet{

    public String index(HttpServletRequest request, HttpServletResponse response) {
        return "test/add";
    }

    public String add(HttpServletRequest request,HttpServletResponse response) {
        return "test/add";
    }

    public String addAction(HttpServletRequest request,HttpServletResponse response) {
        User user = new User();
        user.setUsername(request.getParameter("username"));
        user.setNickname(request.getParameter("nickname"));
        user.setPassword(request.getParameter("password"));
        request.setAttribute("user",user);
        return "test/addAction";
    }
}
